{extend name="public/base"}

{block name="title"}
维修店详情
{/block}

{block name="style"}
{css href="/static/wechat/css/managementshop.css" /}
{/block}

{block name="body"}
<div class="pageControl orderDetails">
    <div class="msui_nav msui_navTop" style="border-bottom: 1px solid #cccccc;align-items: center;">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">店铺详情</h1>
    </div>
    <div class="weui-top">
        <!--店铺列表-->
        <ul>
            <li class="li-dplb mgle0">
                <div class="shopheaddiv">
                    {empty name="data.logo"}
                    <i class="bging shophead1 mgle15" style="background-image: url('/static/wechat/images/1.jpg');"></i>
                    {else /}
                    <i class="bging shophead1 mgle15" style="background-image: url('{$data.logo|get_img_url}');"></i>
                    {/empty}
                </div>
                <div class="shopmsg">
                    <div>
                        <h1 class="fs09">{$data.dealer_name}</h1>
                    <span class="cl-orange">
                    <a class="cl-orange" href="{:url('audit_schedule', ['obj_id' => $data['id'], 'model' => 'dealer'])}">
                        {eq name="data.audit_status" value="1"} 待我审核 {/eq}
                        {eq name="data.audit_status" value="2"} 待平台审核 {/eq}
                        {eq name="data.audit_status" value="3"} 合伙人审核拒绝 {/eq}
                        {eq name="data.audit_status" value="4"} 平台审核通过 {/eq}
                        {eq name="data.audit_status" value="5"} 平台审核拒绝 {/eq}
                        {eq name="data.audit_status" value="6"} 已关闭 {/eq}
                    </a>
                    </span>
                        <div class="shdiv2">
                            <i class="right_sys"></i>
                        </div>
                    </div>
                    <p class="fs06 cl-6666">登录账号 : {$Think.session.phone}</p>
                    <span class="fs06 cl-9999">开店时间 : </span><span class="fs06 cl-9999 data">{$data.apply_time|date="Y-m-d", ###}</span>&nbsp;&nbsp;<span class="fs06 cl-9999">{$data.apply_time|date="H:i", ###}</span>
                </div>
            </li>
        </ul>
        <div>
            <!--店铺详情-->
            <div class="g-dpxx-div">
                <p class="u-dpxx cl-3333">店铺信息</p>
                <!--店铺logo-->
                <div class="m_dp_logo">
                    <p class="m_dp_logo_p">店铺logo</p>
                    <div class="m_mgleft">
                        {empty name="data.logo"}
                        <img class="dp_logo2" src="/static/images/set_logo.png"/>
                        {else /}
                        <img class="dp_logo2" src="{$data.logo|get_img_url}"/>
                        {/empty}
                    </div>
                </div>
                <!--店铺名称-->
                <div class="m_dp_dis">
                    <p class="m_dp_logo_p">店铺名称</p>
                    <div class="m_mgleft">
                        <p>{$data.dealer_name}</p>
                    </div>
                </div>
                <!--联系电话-->
                <div class="m_dp_dis">
                    <p class="m_dp_logo_p">联系电话</p>
                    <div class="m_mgleft">
                        <p>{$data.phone}</p>
                    </div>
                </div>
                <!--店铺地址-->
                <div class="m_dp_dis">
                    <p class="m_dp_logo_p">店铺地址</p>
                    <div class="m_mgleft">
                        <p>{$data.address}</p>
                    </div>
                </div>
            </div>
            <!--实景图片-->
            <div class="g-dpxx-div">
                <p class="u-dpxx cl-3333">实景图片</p>
                <div class="m_mgleft pd150">
                    {notempty name="data.environment_img1"}
                    <div class="dp_logo3">
                        <img class="dp_logo2 dp_logo_nomg" src="{$data.environment_img1|get_img_url}"/>
                    </div>
                    {/notempty}
                    {notempty name="data.environment_img2"}
                    <div class="dp_logo3">
                        <img class="dp_logo2 dp_logo_nomg" src="{$data.environment_img2|get_img_url}"/>
                    </div>
                    {/notempty}
                    {notempty name="data.environment_img3"}
                    <div class="dp_logo3">
                        <img class="dp_logo2 dp_logo_nomg" src="{$data.environment_img3|get_img_url}"/>
                    </div>
                    {/notempty}
                    {notempty name="data.environment_img4"}
                    <div class="dp_logo3">
                        <img class="dp_logo2 dp_logo_nomg" src="{$data.environment_img4|get_img_url}"/>
                    </div>
                    {/notempty}
                    {notempty name="data.environment_img5"}
                    <div class="dp_logo3">
                        <img class="dp_logo2 dp_logo_nomg" src="{$data.environment_img5|get_img_url}"/>
                    </div>
                    {/notempty}
                </div>
            </div>
            <!--实景图片-->
            <div class="g-dpxx-div">
                <p class="u-dpxx cl-3333">入驻等级</p>
                <div class="m_dp_dis">
                    <p class="m_dp_logo_p">等级</p>
                    <div class="m_mgleft">
                        <p>{$data.level|get_level}</p>
                    </div>
                </div>
                <div class="m_dp_dis">
                    <p class="m_dp_logo_p">负责区域</p>
                    <div class="m_mgleft">
                        <p>{$data.duty_area_name}</p>
                    </div>
                </div>
                <div class="m_dp_logo">
                    <p class="m_dp_logo_p">代理证书</p>
                    <div class="m_mgleft">
                        <img class="dp_logo2" src="{$data.collecting_note|get_img_url}"/>
                    </div>
                </div>
            </div>
        </div>
        {eq name="data.audit_status" value="1"}
        <div class="button_sp_area audit">
            <a href="javascript:;" class="weui-btn weui-btn weui-btn_default no" data-dealer-id="{$data.id}" style="width: 46%;margin: 15px 0 15px 3%;display: inline-block;">不通过</a>
            <a href="javascript:;" class="weui-btn weui-btn weui-btn_primary yes" data-dealer-id="{$data.id}" style="width: 44%;margin: 15px 0 15px 3%;display: inline-block;">通过</a>
        </div>
        {/eq}
    </div>
</div>
<!-- loading toast -->
<div id="loadingToast" style="display:none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast" style="opacity: 1; visibility: visible;">
        <i class="weui-loading weui-icon_toast"></i>
        <p class="weui-toast__content">加载中...</p>
    </div>
</div>
{/block}
{block name="javascript"}
<script src="/static/wechat/js/managementshop.js?v={php}echo time(){/php}"></script>
    <script>
        $(function () {
            var obj = {
                obj_id : 0,
                audit_status : 0,
                msg : ''
            };
            $(".audit a").click(function () {
                $('#loadingToast').fadeIn(100);
                var _this = $(this);
                obj.obj_id =  _this.data('dealer-id');
                if (_this.hasClass('yes')) {
                    if (!confirm('确认通过审核？')) {
                        $('#loadingToast').fadeOut(100);
                        return false;
                    }
                    obj.audit_status = 2; // 合伙人通过
                    send_audit()
                } else {
                    //如果参数过多，建议通过 object 方式传入
                    $.prompt({
                        title: '确认拒绝审核?',
                        text: '请输入反馈信息',
                        input: '',
                        empty: false, // 是否允许为空
                        onOK: function (input) {
                            //点击确认
                            obj.msg = input;
                            obj.audit_status = 3; // 合伙人拒绝
                            send_audit()
                        },
                        onCancel: function () {
                            //点击取消
                            $('#loadingToast').fadeOut(100);
                            return false;
                        }
                    });

                }

            });

            function send_audit() {
                $.ajax({
                    type : 'POST',
                    url : '{:url("audit")}',
                    data : {
                        obj_id : obj.obj_id,
                        model : 'dealer',
                        audit_status : obj.audit_status,
                        msg : obj.msg
                    },
                    dataType : 'json',
                    success : function (msg) {
                        $('#loadingToast').fadeOut(100);
                        if (msg.code == 200) {
                            alert('审核成功！！');
                            window.location.reload();
                        } else {
                            var code = msg.code;
                            $.alert(error_code[code]);
                        }
                    }
                });
            }
        })
    </script>
{/block}